<template>
  <div>
    <!-- 我是修改联系人页面 -->
    <component-head title="修改联系人"></component-head>
    <div class="content">
      <div class="content">
      <!-- 联系人编辑 -->
      <van-address-edit
        :area-list="lists"
        show-postal
        show-set-default
        :address-info ="infos[$route.params.index]"
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
      />
    </div>
    </div>
  </div>
</template>

<script>
import componentHead from '@/views/car/components/component'
import {  mapState, mapMutations } from 'vuex'
import { Toast } from 'vant'
export default {
  components: {
    componentHead
  },
    methods: {
    onSave (content) {
      this.editcontact({
        saveinfo: content,
        saveindex: this.$route.params.index
      })
      Toast("修改成功")
    },
    ...mapMutations('addcontact', ['editcontact'])
  },
  computed: {
    ...mapState({
      infos: (state) => state.addcontact.contact
    }),
    ...mapState({
      lists: (state) => state.addcontact.areaList
    })
  }
}
</script>

<style lang="scss" scoped>
  .content{
    margin-top: 46px;
  }
</style>